package pl.PawelAndAlicja.badugiproject.main.Cards;

public class HandTest {

    public static final int AMOUNT_CARDS_IN_HAND = 4;

    public void handDuringGame(FlyweightCard[] tabCard){ // show current hand
		for(int i=0; i< tabCard.length; i++){
            System.out.print(tabCard[i] + ", ");
		}
		System.out.println();
	}
	
	public static void main(String[] args) {

        FlyweightFactoryCard factoryCard = new FlyweightFactoryCard();

		FlyweightCard card;

		HandMaster handMaster = new HandMaster(factoryCard);
		HandTest handTest = new HandTest();

		FlyweightCard[] tabCard = new FlyweightCard[AMOUNT_CARDS_IN_HAND];

		//hand on start
		for(int i = 0; i < tabCard.length; i++){
			card = handMaster.pullOut();
			tabCard[i] = card;
		}

        handTest.handDuringGame(tabCard);
		
		// pull out unnecessary card and take another one in its place
		int whichCard = 1;

		switch(whichCard) {
            case 0: {
                handMaster.pullIn(tabCard[0]);
                tabCard[0]=tabCard[1];
                tabCard[1]=tabCard[2];
                tabCard[2]=tabCard[3];
                tabCard[3]=handMaster.pullOut();
                break;
            }

            case 1: {
                handMaster.pullIn(tabCard[1]);
                tabCard[1]=tabCard[2];
                tabCard[2]=tabCard[3];
                tabCard[3]=handMaster.pullOut();
                break;
            }

            case 2: {
                handMaster.pullIn(tabCard[2]);
                tabCard[2]=tabCard[3];
                tabCard[3]=handMaster.pullOut();
                break;
            }

            case 3: {
                handMaster.pullIn(tabCard[3]);
                tabCard[3]=handMaster.pullOut();
                break;
            }
		}
		handTest.handDuringGame(tabCard);

        handMaster.showDeck();
	}
}
